package mock.servicesdirectory.geography.web.action;

import java.util.ArrayList;
import java.util.List;

import mock.servicesdirectory.geography.web.model.GeographyHung;




import com.opensymphony.xwork2.ActionSupport;

public class GeographyListAction extends ActionSupport {	
	
	private List<GeographyHung> gridModel;	
	private Integer rows = 0;	
	private Integer page = 0;	
	private String sord;	
	private String sidx;
	private String searchField;
	private String searchString;
	private String searchOper;	
	private Integer total = 0;
	private Integer records = 0;
	
	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}

	public String getSearchOper() {
		return searchOper;
	}

	public void setSearchOper(String searchOper) {
		this.searchOper = searchOper;
	}

	public String getSearchString() {
		return searchString;
	}

	public void setSearchString(String searchString) {
		this.searchString = searchString;
	}

	public String getSearchField() {
		return searchField;
	}

	public void setSearchField(String searchField) {
		this.searchField = searchField;
	}

	public String getSidx() {
		return sidx;
	}

	public void setSidx(String sidx) {
		this.sidx = sidx;
	}

	public String getSord() {
		return sord;
	}

	public void setSord(String sord) {
		this.sord = sord;
	}

	public List<GeographyHung> getGridModel() {
		return gridModel;
	}

	public void setGridModel(List<GeographyHung> gridModel) {
		this.gridModel = gridModel;
	}

	public String execute() {		
		records = 30;
		rows = 10;
		GeographyHung item;
		List<GeographyHung> service = new ArrayList<GeographyHung>();
		item = new GeographyHung();
		item.setGeographyName("a");
		item.setGeographyType("b");
		item.setDescription("c");
		item.setContact("a");
		item.setIsActive("Yes");
		service.add(item);
		for (int i = 1; i < 30; i++) {
			item = new GeographyHung();
			item.setGeographyName("a");
			item.setGeographyType("b");
			item.setDescription("c");
			item.setContact("a");
			item.setIsActive("No");
			service.add(item);
		}
		
		setGridModel(service);

		setTotal((int) Math.ceil((double) records / (double) rows));

		return SUCCESS;
	}

	public String getJSON() {
		return execute();
	}
	
	public String back(){
		
		return SUCCESS;
	}
	
	public String create(){
		
		return SUCCESS;
	}
	
	  /**
     * Method used to redirect to Trust Region List page from menu list
     * @return
     */
    public String listtrustRegion(){
    	return SUCCESS;
    }
    
    /**
     * Method used to redirect to Governmen tOffice Region List page from menu list
     * @return
     */
    public String listGovernmentOfficeRegion(){
    	return SUCCESS;
    }
}